if [ -n "$1" ]; then
    data_date=$1
else
  data_date=`date -d '-1 days' +%F`
fi

ods_ads_log_info="
LOAD DATA INPATH '/warehouse/ads_logs/${data_date}'
OVERWRITE INTO TABLE jtp_app_warehouse.ods_ads_log_info PARTITION (dt = '${data_date}');
"

ods_ads_info_full="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/${data_date}/t_ads_ads'
OVERWRITE INTO TABLE jtp_app_warehouse.ods_ads_info_full PARTITION (dt = '${data_date}');
"

ods_ads_platform_full="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/${data_date}/t_ads_ads_platform'
    OVERWRITE INTO TABLE jtp_app_warehouse.ods_ads_platform_full PARTITION (dt = '${data_date}');
"

ods_platform_full="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/${data_date}/t_ads_platform_info'
    OVERWRITE INTO TABLE jtp_app_warehouse.ods_platform_full PARTITION (dt = '${data_date}');
"

ods_ads_product="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/${data_date}/t_ads_product'
    OVERWRITE INTO TABLE jtp_app_warehouse.ods_ads_product PARTITION (dt = '${data_date}');
"

/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "
${ods_ads_log_info}
${ods_ads_info_full}
${ods_ads_platform_full}
${ods_platform_full}
${ods_ads_product}
"